package com.example.warehousems.event.listener;

import com.example.warehousems.component.UserInfo;
import com.example.warehousems.event.event.JobTicketEvent;
import com.example.warehousems.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
public class JobTicketListener implements ApplicationListener<JobTicketEvent>{
    @Autowired
    private ActivityService activityService;

    @Override
    public void onApplicationEvent(JobTicketEvent event) {
        activityService.addActivity(event.getArrivalUserId(), event.getTitle(), event.getDescription());
        System.out.println(event);
    }
}
